﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainningCShape_Week01.DA;
using System.Collections;
using TrainningCShape_Week01.DO;

namespace TrainningCShape_Week01.BL
{
    class LoginControl
    {
        public static bool AddUser(UserInfo user)
        {
            return LoginIO.AddUsers(user);
        }
        public static bool validateUser(UserInfo user)
        {
            ArrayList UserList = LoginIO.LoadUsers();
            //foreach (UserInfo user in UserList)
            //{
            //    if(pUser.Equals(user.Username)&&(pPass.Equals(user.Password)))
            //    {
            //        return true;
            //    }
            //}
            foreach (UserInfo  item in UserList)
            {
                if (user.Username == item.Username  && user.Password == item.Password)
                {
                    return true;
                }
            }
            return false;
        }
    }
}
